package controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
public class RestFulController {
    //映射访问路径,必须是Get请求
    @RequestMapping(value = "/hello", method = {RequestMethod.GET})
    public String index2(Model model) {
        model.addAttribute("msg", "hello!");
        return "hello";
    }

    //映射访问路径,必须是Post请求
    @PostMapping("/hello")
    public String index1(Model model) {
        model.addAttribute("msg", "hello!");
        return "hello";
    }
}
